/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.mldn.demo;

/**
 *
 * @author Administrator
 */
public class AbstractCaseDemo2 {
    public static void main(String[] args) {
        Person03 per1 = new Student03("zhangsan", 20, 99.0f);
        per1.say();
        Person03 per2 = new Worker("lisi", 30, 3000.0f);
        per2.say();
    }
}

abstract class Person03 {
    private String name;
    private int age;
    public Person03(String name, int age){
        this.name = name;
        this.age = age;
    }

    public int getAge() {
        return age;
    }

    public String getName() {
        return name;
    }
    
    public void say(){
        System.out.println(this.getContent());
    }
    
    public abstract String getContent();
}

class Student03 extends Person03 {
    private float score;

    public Student03(String name, int age, float score) {
        super(name, age);
        this.score = score;
    }

    public float getScore() {
        return score;
    }

    
    
    @Override
    public String getContent() {
        return "学生信息-> 姓名："+ super.getName()+" ；年龄："+super.getAge()+
                " ；成绩："+this.getScore();
    }   
}

class Worker extends Person03{
    private float salary;

    public Worker(String name, int age, float salary) {
        super(name, age);
        this.salary = salary;
    }

    public float getSalary() {
        return salary;
    }

    @Override
    public String getContent() {
        return "工人信息-> 姓名："+ super.getName()+" ；年龄："+super.getAge()+
                " ；工资："+this.getSalary();
    }
    
    
    
}
